import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

const login = r => require.ensure([], () => r(require('@/page/login')), 'login');
const index = r => require.ensure([], () => r(require('@/page/index')), 'index');
const detailed = r => require.ensure([], () => r(require('@/page/detailed')), 'detailed');
const manage = r => require.ensure([], () => r(require('@/page/manage')), 'manage');
const home = r => require.ensure([], () => r(require('@/page/home')), 'home');
const sendMessage = r => require.ensure([], () => r(require('@/page/sendMessage')), 'sendMessage');
const detailedMsg = r => require.ensure([], () => r(require('@/page/detailedMsg')), 'detailedMsg');
const integration = r => require.ensure([], () => r(require('@/page/integration')), 'integration');
const vip = r => require.ensure([], () => r(require('@/page/vip')), 'vip');
const makeComplaintsList = r => require.ensure([], () => r(require('@/page/makeComplaintsList')), 'makeComplaintsList');
const singleDryingList = r => require.ensure([], () => r(require('@/page/singleDryingList')), 'singleDryingList');
const latestInfo = r => require.ensure([], () => r(require('@/page/latestInfo')), 'latestInfo');
const popularAct = r => require.ensure([], () => r(require('@/page/popularAct')), 'popularAct');
const pointsdraw = r => require.ensure([], () => r(require('@/page/pointsdraw')), 'pointsdraw');
const courtesy = r => require.ensure([], () => r(require('@/page/courtesy')), 'courtesy');
const question = r => require.ensure([], () => r(require('@/page/question')), 'question');

const routes = [
	{
		path: '/',
		component: login
	},
	{
		path: '/manage',
		component: manage,
		name: '',
		children: [{
			path: '',
			component: index,
			meta: [],
		},{
			path: '/detailed',
			component: detailed,
			meta: ['用户资料详情'],
		},{
			path: '/sendMessage',
			component: sendMessage,
			meta: ['用户消息管理'],
		},{
			path: '/detailedMsg',
			component: detailedMsg,
			meta: ['发送消息'],
		},{
			path: '/integration',
			component: integration,
			meta: ['用户积分管理'],
		},{
			path: '/vip',
			component: vip,
			meta: ['vip管理'],
		},{
				path: '/makeComplaintsList',
				component: makeComplaintsList,
				meta: ['个人中心', '用户吐槽管理'],
		},{
				path: '/singleDryingList',
				component: singleDryingList,
				meta: ['个人中心', '用户晒单管理'],
		},{
				path: '/popularAct',
				component: popularAct,
				meta: ['个人中心', '活动管理'],
		},{
				path: '/latestInfo',
				component: latestInfo,
				meta: ['个人中心', '资讯管理'],
		},{
            path: '/question',
            component: question,
            meta: ['个人中心', '问卷管理'],
        },{
			path: '/pointsdraw',
			component: pointsdraw,
			meta: ['签到模块', '积分抽奖管理'],
	},{
		path: '/courtesy',
		component: courtesy,
		meta: ['签到模块', '天天有礼管理'],
}]
	}
]

export default new Router({
	routes,
	strict: process.env.NODE_ENV !== 'production',
})
